package com.wf.course.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.utils.page.PageBean;
import com.wf.course.dao.ICardCourseRelationMapper;
import com.wf.course.model.ad.CardCourseRelation;
import com.wf.course.service.ICardCourseRelationService;

@Service
@Transactional(rollbackFor=Exception.class)
public class ICardCourseRelationServiceImpl implements ICardCourseRelationService{
	
	@Autowired
	private ICardCourseRelationMapper mapper;

	@Override
	public void indexInfo(PageBean<CardCourseRelation> pageBean) {
		// TODO Auto-generated method stub
		pageBean.setResults(this.mapper.queryList(pageBean));
		pageBean.setTotalCount(this.mapper.getTotalCount(pageBean));
	}

	@Override
	public void saveOrUpdateCardCourseRelation(CardCourseRelation cardCourseRelation) {
		// TODO Auto-generated method stub
		
		//添加
		if(cardCourseRelation.getId()==null){
			this.mapper.saveCardCourseRelation(cardCourseRelation);
		}else{
		 //修改
		  this.mapper.updateCardCourseRelation(cardCourseRelation);
			
		}
		
	}

	@Override
	public CardCourseRelation queryCardCourseRelationById(Integer id) {
		// TODO Auto-generated method stub
		return this.mapper.queryCardCourseRelationById(id);
	}

	@Override
	public void deleteById(Integer id) {
		// TODO Auto-generated method stub
		this.mapper.deleteById(id);
	}

	 
	@Override
	public List<CardCourseRelation> queryCardCourseRelations(){
		return this.mapper.queryCardCourseRelations();
	}

	
}
